package com.sheep.pattern;

import java.util.function.Function;

/**
 * @author wangze
 * @date 2021-01-14 15:44.
 **/
public class FunctionTest {

	public static void main(String[] args) {
		Function<Integer,Integer>  f1=i-> i*2;
		Function<Integer,Integer>  f2=i-> i*i;

		System.out.println(f1.apply(10));
        // 200
		Integer r1=  f1.compose(f2).apply(10);
        // 400
		Integer r2=f1.andThen(f2).apply(10);

		System.out.println(r1);

		System.out.println(r2);

	}
}
